<?php

declare(strict_types=1);
namespace App\Controller\Admin;


use App\Controller\AbstractController;
use App\Request\Admin\FinanceRequest;
use App\Service\Admin\FinanceService;
use Hyperf\Di\Annotation\Inject;

class FinanceController extends AbstractController
{
    /**
     * @Inject()
     * @var FinanceService
     */
    protected $financeService;

    /**
     * 提现流水列表
     * @param FinanceRequest $request
     * @return mixed|\Psr\Http\Message\ResponseInterface
     */
    public function WithdrawList(FinanceRequest $request)
    {
        $query = $request->all();
        $data = $this->financeService->getWithdrawList($query);
        return $this->response->success($data);
    }

    /**
     * 平台提成流水
     * @param FinanceRequest $request
     * @return mixed|\Psr\Http\Message\ResponseInterface
     */
    public function PercentageList(FinanceRequest $request)
    {
        $query = $request->all();
        $data = $this->financeService->getPercentageList($query);
        return $this->response->success($data);
    }

    /**
     * 悬案主充值流水
     * @param FinanceRequest $request
     * @return mixed|\Psr\Http\Message\ResponseInterface
     */
    public function RechargeList(FinanceRequest $request)
    {
        $query = $request->all();
        $data = $this->financeService->getRechargeList($query);
        return $this->response->success($data);
    }


    /**
     * 流水导出
     * @param FinanceRequest $request
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
     */
    public function LogExport(FinanceRequest $request)
    {
       $validated =  $request->validated();
       $query = $request->all();
       return $this->financeService->LogExport($validated,$query);
    }

}